package club.xyes.zkh.ecommerce.commons.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * Create by 郭文梁 2019/4/17 0017 10:09
 * Commodity
 * 商品实体类
 *
 * @author 郭文梁
 * @data 2019/4/17 0017
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "t_commodity")
public class Commodity extends BaseEntity {
    /**
     * 商品状态：正常 上架
     */
    public static final int STATE_ENABLE = 0x01;
    /**
     * 商品状态：不可用 已下架
     */
    public static final int STATE_REMOVED = 0x02;
    /**
     * 分类ID
     */
    @Column(name = "classification_id", length = 10, nullable = false)
    private Integer classificationId;
    /**
     * 关联的分类对象
     */
    private CommodityClassification classification;
    /**
     * 商品名称
     */
    @Column(name = "name", nullable = false)
    private String name;
    /**
     * 价格 单位分
     */
    @Column(name = "price", length = 10)
    private Integer price;
    /**
     * 商品描述
     */
    @Column(name = "description")
    private String description;
    /**
     * 封面图片
     */
    @Column(name = "front_cover")
    private String frontCover;
    /**
     * 是否为推荐商品
     */
    @Column(name = "recommend", nullable = false)
    private Boolean recommend;
    /**
     * 商品状态
     */
    @Column(name = "state", nullable = false, length = 2)
    private Integer state;
}
